

export const createPagedQuery = function (pagination: ClientPagination , input: any): any {
    const query = Object.assign({}, input);
        query.skipCount = (pagination.current - 1) * pagination.pageSize;
        query.maxResultCount = pagination.pageSize;
        query.readOnly = pagination.readOnly

    return query;
}

export interface IDialogProps {
    id: string
    open: boolean
    data: any
    title: string
    loading: boolean
}

export class ClientPagination {
    current: number = 1
    pageSize: number = 20
    defaultPageSize: number = 20
    pageSizeOptions: Array<number> = [20, 30, 50]
    showQuickJumper: boolean = true
    showSizeChanger: boolean = true
    responsive: boolean = true
    total: number = 0
    readOnly:boolean=true
    handleChange:Function|undefined
    constructor(loadData:Function){
        this.current = 1;
        this.pageSize =20;
        this.defaultPageSize=20;
        this.pageSizeOptions=[20,30,50];
        this.showQuickJumper=true;
        this.showSizeChanger=true;
        this.responsive=true;
        this.total=0;
        this.readOnly=true;
        this.handleChange = ({current,pageSize})=>{
           this.current = current;
           this.pageSize= pageSize;
           if(loadData&&typeof loadData=='function'){
                loadData();
           }
        }
      
    }
}
